package edu.towson.cosc603.coffeemaker;

import junit.framework.TestCase;

/**
 *
 */
public class CoffeeMakerTest extends TestCase {
	
	private CoffeeMaker cm;
	private Inventory i;
	private Recipe r1;
	private final int NUM_RECIPES = 4;
	
	public void setUp() {
		cm = new CoffeeMaker();
		i = cm.checkInventory();

		r1 = new Recipe();
		r1.setName("Coffee");
		r1.setPrice(50);
		r1.setAmtCoffee(6);
		r1.setAmtMilk(1);
		r1.setAmtSugar(1);
		r1.setAmtChocolate(0);
	}
	
	public void testMakeCoffee() {			
		assertEquals(20, cm.makeCoffee(r1, 20));
		assertEquals(10, cm.makeCoffee(r1, 60));
	}	

	public void testMakeCoffee1() {			
		assertEquals(0, cm.makeCoffee(r1, 0));
		
	}	
	
	public void testAddRecipe1() {
		assertTrue(cm.addRecipe(r1));
	}	
	
	public void testDeleteRecipe1() {
		cm.addRecipe(r1);
		assertTrue(cm.deleteRecipe(r1));
	}

	public void testEditRecipe1() {
		cm.addRecipe(r1);
		Recipe newRecipe = new Recipe();
		newRecipe = r1;
		newRecipe.setAmtSugar(2);
		assertTrue(cm.editRecipe(r1, newRecipe));
	}
	
	public void testAddInventory(){
    
         cm.addInventory(-1, -1, 1, -1);
         assertTrue(cm.addRecipe(r1));
            
    } 
	
	public void testAddInventory1(){
		
		cm.addInventory(15, 15, 15, 15);
		assertEquals(30, i.getChocolate());
		assertEquals(30, i.getCoffee());
		assertEquals(30, i.getSugar());
		assertEquals(30, i.getMilk());
		
	}
	
	 public void testGetRecipes(){
		 cm.getRecipes();
		 assertEquals("Coffee", r1.getName());
		 assertEquals(50, r1.getPrice());
		 assertEquals(6, r1.getAmtCoffee());
		 assertEquals(1, r1.getAmtMilk());
		 assertEquals(1, r1.getAmtSugar());
		 assertEquals(0, r1.getAmtChocolate());
         
 } 
	

    public void testGetRecipeForName(){
    
            cm.addRecipe(r1);
            assertEquals(r1, cm.getRecipeForName("Coffee"));
    } 

    

	
}